<!-- 开关组件 -->
<template>
    <Switch v-model="content" @on-change="changeValue" :disabled="props.setConfig.disabled"  />
</template>

<script setup>
import { ref } from 'vue';

/**
 * @param {
 *      setConfig: {
 *          disabled: '禁用'
 *      }
 * }
 */
const props = defineProps({
    setConfig: {
        type: Object,
    },
    modelValue: {
        type: Boolean,
        default: false
    },
});

const emit = defineEmits(['update:modelValue']);

// 双向绑定内容
const content = ref(props.modelValue);

// 提交更新
const changeValue = (val) => {
    emit('update:modelValue', val);
}
</script>